import { contextBridge, ipcRenderer } from 'electron';

// 定义 API 接口
interface ElectronAPI {
    toggleExamMode: () => Promise<any>;
    getExamModeStatus: () => Promise<any>;
    getOSInfo: () => Promise<any>;
}

// 扩展 Window 接口
declare global {
    interface Window {
        electronAPI: ElectronAPI;
    }
}

contextBridge.exposeInMainWorld('electronAPI', {
    toggleExamMode: () => ipcRenderer.invoke('toggle-exam-mode'),
    getExamModeStatus: () => ipcRenderer.invoke('get-exam-mode-status'),
    getOSInfo: () => ipcRenderer.invoke('get-os-info')
});